<template>
  <div class="recording-clipping-container">
    <!-- 统计卡片 -->
    <el-row :gutter="8" class="stats-row">
      <el-col :span="6">
        <el-card class="stat-card" :body-style="{ padding: '0', height: '48px' }">
          <div class="stat-content">
            <el-icon class="stat-icon primary"><VideoCamera /></el-icon>
            <div class="stat-text">
              <div class="stat-number">{{ totalRecordings }}</div>
              <div class="stat-label">直播录制</div>
            </div>
          </div>
        </el-card>
      </el-col>
      <el-col :span="6">
        <el-card class="stat-card" :body-style="{ padding: '0', height: '48px' }">
          <div class="stat-content">
            <el-icon class="stat-icon success"><VideoPlay /></el-icon>
            <div class="stat-text">
              <div class="stat-number">{{ completedRecordings }} / {{ activeRecordings }}</div>
              <div class="stat-label">录制完成/进行中</div>
            </div>
          </div>
        </el-card>
      </el-col>
      <el-col :span="6">
        <el-card class="stat-card" :body-style="{ padding: '0', height: '48px' }">
          <div class="stat-content">
            <el-icon class="stat-icon info"><Scissor /></el-icon>
            <div class="stat-text">
              <div class="stat-number">{{ totalClipTasks }}</div>
              <div class="stat-label">拆条任务</div>
            </div>
          </div>
        </el-card>
      </el-col>
      <el-col :span="6">
        <el-card class="stat-card" :body-style="{ padding: '0', height: '48px' }">
          <div class="stat-content">
            <el-icon class="stat-icon warning"><Loading /></el-icon>
            <div class="stat-text">
              <div class="stat-number">{{ completedClipTasks }} / {{ processingClipTasks }}</div>
              <div class="stat-label">拆条完成/进行中</div>
            </div>
          </div>
        </el-card>
      </el-col>
    </el-row>

    <!-- 标签页切换 -->
    <el-tabs v-model="activeTab" type="border-card" @tab-change="handleTabChange" class="main-tabs enhanced-tabs">
      <!-- 录制管理标签页 -->
      <el-tab-pane label="录制管理" name="recordings">
        <RecordingList />
      </el-tab-pane>
      <!-- 拆条任务标签页 -->
      <el-tab-pane label="拆条任务" name="cliptasks">
        <ClipTaskList />
      </el-tab-pane>
    </el-tabs>

    <!-- 对话框组件 -->
    <VideoPlayerDialog />
    <ClipDialog />
    <FileListDialog />
  </div>
</template>

<script setup>
import { VideoCamera, Folder, Scissor, Loading } from '@element-plus/icons-vue'
import { useRecordingClipping } from './recording-clipping/useRecordingClipping'
import RecordingList from './recording-clipping/RecordingList.vue'
import ClipTaskList from './recording-clipping/ClipTaskList.vue'
import VideoPlayerDialog from './recording-clipping/VideoPlayerDialog.vue'
import ClipDialog from './recording-clipping/ClipDialog.vue'
import FileListDialog from './recording-clipping/FileListDialog.vue'

// 使用录制拆条功能钩子
const {
  activeTab,
  totalRecordings,
  completedRecordings,
  activeRecordings,
  totalClipTasks,
  completedClipTasks,
  processingClipTasks,
  handleTabChange
} = useRecordingClipping()
</script>

<style scoped>
.recording-clipping-container {
  padding: 12px;
  background-color: #f5f5f5;
  min-height: 80vh;
  overflow-x: hidden;
}

.page-header {
  margin-bottom: 12px;
}

.page-header h1 {
  margin: 0;
  font-size: 24px;
  color: #303133;
}

.stats-row {
  margin-bottom: 12px;
}

.stat-card {
  height: 48px;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  border: 1px solid #e8e8e8;
  transition: all 0.3s ease;
}

.stat-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transform: translateY(-1px);
}

.stat-content {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 8px;
  padding: 0 12px;
}

.stat-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.stat-icon.primary {
  color: #409eff;
}

.stat-icon.success {
  color: #67c23a;
}

.stat-icon.info {
  color: #909399;
}

.stat-icon.warning {
  color: #e6a23c;
}

.stat-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.stat-number {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
  color: #333;
}

.stat-label {
  font-size: 12px;
  line-height: 1.2;
  color: #666;
}

.main-tabs {
  margin-top: 12px;
}

/* 优化标签样式使其更显眼 */
.enhanced-tabs {
  /* 标签头容器 */
  .el-tabs__header {
    margin-bottom: 10px;
  }
  
  /* 标签导航容器 */
  .el-tabs__nav {
    height: 48px;
  }
  
  /* 单个标签项 */
  .el-tabs__item {
    font-size: 16px;
    font-weight: 700; /* 进一步加粗 */
    padding: 0 24px;
    height: 48px;
    line-height: 48px;
    transition: all 0.3s ease;
  }
  
  /* 标签项悬停效果 */
  .el-tabs__item:hover {
    color: #1890ff;
    font-weight: 700;
    background-color: rgba(24, 144, 255, 0.05); /* 添加背景色 */
  }
  
  /* 当前激活的标签项 */
  .el-tabs__item.is-active {
    color: #1890ff;
    font-weight: 800; /* 最大加粗 */
    font-size: 17px;
    background-color: rgba(24, 144, 255, 0.1); /* 添加激活状态背景色 */
    border-radius: 4px 4px 0 0;
  }
  
  /* 激活标签的下划线指示器 */
  .el-tabs__active-bar {
    height: 4px; /* 增加高度 */
    background-color: #1890ff;
    border-radius: 2px;
  }
}
</style>